package com.zhongke.common.base.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import com.zhongke.common.R

/**
 * @author: ZhangQingHua
 * @date: 2021/11/24
 * @description
 */
class ZKErrorFragment: Fragment() {

    companion object {
        const val TAG_MSG = "tag_msg"

        fun newInstance(errMsg: String): ZKErrorFragment {
            val args = Bundle().apply {
                putString(TAG_MSG, errMsg)
            }

            val fragment = ZKErrorFragment()
            fragment.arguments = args
            return fragment
        }
    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        return inflater.inflate(R.layout.fragment_error, null).findViewById<TextView>(R.id.text).apply {
            text = arguments?.getString(TAG_MSG) ?: "No Error"
        }
    }

}